<div class = "ui modal large">
    <i class = "close icon" ng-click="closeAddTable()"></i>
    <div class = "header clearfix">
        添加数据库表
        <b style="display: none" class = "fr cp" ng-click = "tableListShown = true" ng-hide = "tableListShown">返回上一步</b>
    </div>
    <div class = "clearfix p15">
        <!--表列表-->
        <div ng-show = "tableListShown">
            <div class = "ui selection dropdown" style="padding: 5px">
                <input type = "hidden" name = "gender">
                <i class = "dropdown icon"></i>
                <div class = "default text" style="color:red;" ng-if="databases.length==0">该数据源无数据库</div>
                <div class = "default text" ng-if="databases.length !=0">请选择数据库</div>
                <div class = "menu">
                    <div class = "item" data-value = "mysql" ng-repeat = "db in databases" ng-click = "changeDataBase(db.dataBaseName)">{{db.dataBaseName}}</div>
                </div>
            </div>
            <div class = "ui large icon input fr mini">
                <input type = "text" placeholder = "搜索表名或者表注释" ng-model = "search.name">
                <i class = "search icon"></i>
            </div>
            <div class = "addTableBox mt10" style = "overflow:auto;">
                <table class = "ui table striped">
                    <thead>
                        <tr align="center">
                            <th>序号</th>
                            <th>表名</th>
                            <th>表备注</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat = "table in dbTables" ng-show = "table.shown && !table.added">
                            <td>{{$index+1}}</td>
                            <td>{{table.tableName}}</td>
                            <td>{{table.tableDesc}}</td>
                            <td>{{table.createTime}}</td>
                            <td>
                                <div ng-show="table.isAdded">已添加</div>
                                <button ng-hide="table.isAdded" class = "ui red button" ng-click = "getDatabaseTableColumns(table.tableName,table.tableDesc,$index)">添加此表</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <!--选择字段导入-->
        <div ng-hide = "tableListShown">
            <div class = "addTableBox mt10">
                <div class = "ui input inputB">
                    <span class = "mr10">表注释:</span>
                    <input type = "text" class = "w400" placeholder = "" ng-model = 'tableDesc'>
                </div>
                <table class = "ui table striped">
                    <thead>
                        <tr align="center">
                            <th style="width:80px">
                                <div class = "ui checkbox">
                                    <input type = "checkbox" name = "example" ng-model = "selectedAll.isSelected">
                                    <label>全选</label>
                                </div>
                            </th>
                            <th>字段名</th>
                            <th>字段注释</th>
                            <th>字段类型</th>
                            <th>数据示例</th>
                            <th class = "w150">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat = "column in tbColumns">
                            <td>
                                <div class = "ui checkbox">
                                    <input type = "checkbox" ng-checked = "column.selected" ng-click="checkIt($index)">
                                    <label></label>
                                </div>
                            </td>
                            <td>{{column.columnName}}</td>
                            <td>
                                <div class = "ui input">
                                    <input type = "text" placeholder = "字段注释" ng-model = "column.columnDesc">
                                </div>
                            </td>
                            <td>{{column.columnType}}</td>
                            <td class="colExa" title="{{column.columnExa}}"><div class="divExa">{{column.columnExa}}</div></td>
                            <td>
                                <button class = "ui default button" ng-click = "column.selected = false;">隐藏</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class = "tc mt20">
                <button class="ui green button" ng-click = "tableListShown = true" ng-hide = "tableListShown"><i class="arrow circle left icon"></i>返回</button>
                <button class = "ui red button" ng-click = "importDatabaseTable($event)">确定添加</button>
            </div>
        </div>
    </div>
</div>